/*
 * @Author: c
 * @Date: 2024-01-08 21:28:05
 * @LastEditTime: 2024-03-09 21:19:31
 * @LastEditors: c
 * @Description:
 * @FilePath: \music-web-admin\src\api\application\banner\index.ts
 * https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// Copyright 2024 Administrator
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by https://quicktype.io

import { Delete, Get, Post, Put } from "@/http/http";
import { BannerForm, BannerQuery, BannerVO } from "./type";

/**
 * 类别-下拉列表-获取
 *
 * @param queryParams
 */
export function getBannerOptions(): Promise<OptionType[]> {
  return Get("/api/v1/banner/options");
}

/**
 * 轮播图-列表-获取
 * @param queryParams
 * @returns
 */
export function listBanners(
  queryParams: BannerQuery
): Promise<PageResult<BannerVO[]>> {
  return Get("/api/v1/banner/page", queryParams);
}

/**
 * 轮播图-表单数据-获取
 *
 * @param id
 */
export function getBannerForm(id: number): Promise<BannerForm> {
  return Get("/api/v1/banner/" + id + "/form");
}

/**
 * 轮播图-新增
 *
 * @param data
 */
export function addBanner(data: BannerForm) {
  return Post("/api/v1/banner", data);
}

/**
 * 轮播图-修改
 *
 * @param id
 * @param data
 */
export function updateBanner(id: number, data: BannerForm) {
  return Put("/api/v1/banner/" + id, data);
}

/**
 * 轮播图-删除
 *
 * @param id 轮播图ID
 */
export function deleteBanner(ids: number[] | number) {
  return Delete("/api/v1/banner/" + ids);
}
